#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;
int a[N], f[N];

int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        f[i] = 0;
    }
    for (int i = 2; i <= n; i++) {
        if (a[i] != -1) {
            int flag = 0;
            for (int j = 1; j <= i; j++) {
                if (a[j] < a[i] && a[j] != -1 && f[i] != 1) {
                    a[j] = -1;
                    flag = 1;
                    f[i] = 1;
                    break;
                }
            }
            if (flag == 0) {
                for (int j = i + 1; j <= n; j++) {
                    if (a[j] < a[i] && a[j] != -1) {
                        a[j] = -1;
                        flag = 1;
                        f[i] = 1;
                        break;
                    }
                }
            }
        }

    }
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] != -1) {
            cnt++;
        }
    }
    cout << cnt;

    return 0;

    fclose(stdin);
    fclose(stdout);
}
